//---------------------------------------------------------------------------

#include <vcl.h>
#include <stdio.h>
#pragma hdrstop

#include "Unit_principal.h"
#include "Unit_cadalunos.h"
#include "Unit_caddisciplinas.h"
#include "Unit_cadnotas.h"
#include "Unit_listaalunos.h"
#include "Unit_editardis.h"
#include "Unit_exibiralunos.h"

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFmPrincipal *FmPrincipal;
//---------------------------------------------------------------------------
__fastcall TFmPrincipal::TFmPrincipal(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TFmPrincipal::BtnSairClick(TObject *Sender)
{
Close();        
}
//---------------------------------------------------------------------------
void __fastcall TFmPrincipal::SMnSairClick(TObject *Sender)
{
 BtnSair->Click();        
}
//---------------------------------------------------------------------------
void __fastcall TFmPrincipal::SmnCadAlunosClick(TObject *Sender)
{
  StatusBarPrincipal->Panels->Items[1]->Text = " Cadastrando novo aluno";
  FmCadAlunos->ShowModal();
  StatusBarPrincipal->Panels->Items[1]->Text = "";

}
//---------------------------------------------------------------------------


void __fastcall TFmPrincipal::SmnCadDisciplinasClick(TObject *Sender)
{
  StatusBarPrincipal->Panels->Items[1]->Text = " Cadastrando nova disciplina";
  FmCadDisciplinas->ShowModal();
  StatusBarPrincipal->Panels->Items[1]->Text = "";
}
//---------------------------------------------------------------------------

void __fastcall TFmPrincipal::SmnCadNotasClick(TObject *Sender)
{
  StatusBarPrincipal->Panels->Items[1]->Text = " Cadastrando notas";
  FmCadNotas->ShowModal();
  StatusBarPrincipal->Panels->Items[1]->Text = "";
}
//---------------------------------------------------------------------------


void __fastcall TFmPrincipal::FormCloseQuery(TObject *Sender,
      bool &CanClose)
{

  if ((Application->MessageBox(
      "Deseja realmente sair do sistema?", "Saindo do Sistema",
      MB_YESNO | MB_ICONQUESTION))== IDYES)
  {
    Application->Terminate();
  }
  else
  {
    CanClose = False;
  }

}
//---------------------------------------------------------------------------

void __fastcall TFmPrincipal::SmnListarAlunosClick(TObject *Sender)
{
  StatusBarPrincipal->Panels->Items[1]->Text = " Editando dados de alunos";
  FmEditarAluno->ShowModal();
  StatusBarPrincipal->Panels->Items[1]->Text = "";
}
//---------------------------------------------------------------------------

void __fastcall TFmPrincipal::Disciplinas1Click(TObject *Sender)
{
  StatusBarPrincipal->Panels->Items[1]->Text = " Editando dados de disciplinas";
  FmEditarDis->ShowModal();
  StatusBarPrincipal->Panels->Items[1]->Text = "";
}
//---------------------------------------------------------------------------

void __fastcall TFmPrincipal::OrdemAlfabtica1Click(TObject *Sender)
{
  StatusBarPrincipal->Panels->Items[1]->Text = " Exibindo notas";
  FmExibirAlunos->ShowModal();
  StatusBarPrincipal->Panels->Items[1]->Text = "";
}
//---------------------------------------------------------------------------








void __fastcall TFmPrincipal::Timer1Timer(TObject *Sender)
{
  TDateTime data;
  StatusBarPrincipal->Panels->Items[2]->Text = "            " + TimeToStr(data.CurrentTime());
}
//---------------------------------------------------------------------------

